package com.huatai.exchange.deal;

import com.faneui.common.exception.BusinessException;
import com.huatai.exchange.facade.Contents;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FileCreateDealFactory {

    @Autowired
    private FileCreateDealService fileCreateFtpDealService;

    @Autowired
    private FileCreateDealService fileCreateHttpDealService;

    @Autowired
    private FileCreateDealService fileCreateMailDealService;

    @Autowired
    private FileCreateDealService fileCreateSmbDealService;

    @Autowired
    private FileCreateDealService fileCreateSqlDealService;

    @Autowired
    private FileCreateDealService fileCreateVelocityDealService;

    @Autowired
    private FileCreateDealService fileCreateLoadDealService;

    public FileCreateDealService getDealService(String fileGetType) throws BusinessException {
        if (Contents.FILE_GET_TYPE_HTTP.equals(fileGetType)) { // http 获取文件
            return fileCreateHttpDealService;
        } else if (Contents.FILE_GET_TYPE_SMB.equals(fileGetType)) {
            return fileCreateSmbDealService;
        } else if (Contents.FILE_GET_TYPE_VELOCITY.equals(fileGetType)) {
            return fileCreateVelocityDealService;
        } else if (Contents.FILE_GET_TYPE_SQL.equals(fileGetType)) {
            return fileCreateSqlDealService;
        } else if (Contents.FILE_GET_TYPE_LOAD.equals(fileGetType)) {
            return fileCreateLoadDealService;
        } else if (Contents.FILE_GET_TYPE_FTP.equals(fileGetType)) {
            return fileCreateFtpDealService;
        } else if (Contents.FILE_GET_TYPE_MAIL.equals(fileGetType)) {
            return fileCreateMailDealService;
        } else {
            throw new BusinessException("无效文件获取类型");
        }
    }


}
